package com.edu.exam.enums.examination.paper;

/**
 * 归档状态枚举
 *
 * 从StandardizedImage实体类中提取的独立枚举
 *
 * @author System
 * @version 1.0.0
 */
public enum ArchiveStatus {
    ACTIVE("活跃"),
    ARCHIVED("已归档"),
    PENDING("待归档"),
    EXPIRED("已过期"),
    DELETED("已删除"),
    LOCKED("已锁定"),
    UNLOCKED("未锁定"),
    TEMPORARY("临时"),
    PERMANENT("永久"),
    DRAFT("草稿"),
    PUBLISHED("已发布"),
    PROCESSING("处理中"),
    COMPLETED("已完成"),
    FAILED("失败"),
    CANCELLED("已取消"),
    SUSPENDED("已暂停"),
    REVIEWED("已审核"),
    APPROVED("已批准"),
    REJECTED("已拒绝"),
    BACKUP("备份"),
    RESTORED("已恢复"),
    MIGRATED("已迁移"),
    CORRUPTED("已损坏"),
    INACCESSIBLE("不可访问"),
    READ_ONLY("只读"),
    MODIFIABLE("可修改");

    private final String description;

    ArchiveStatus(String description) {
        this.description = description;
    }

    public String getDescription() {
        return description;
    }

    /**
     * 从描述创建枚举实例
     *
     * @param description 枚举描述
     * @return 对应的枚举实例
     * @throws IllegalArgumentException 如果描述无效
     */
    public static ArchiveStatus fromDescription(String description) {
        for (ArchiveStatus status : values()) {
            if (status.getDescription().equals(description)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown archive status description: " + description);
    }

    @Override
    public String toString() {
        return description;
    }
}